/*
 * File:   Creature.cpp
 * Author: Twelve
 *
 * Created on 4 Январь 2011 г., 21:29
 */

#include "creature.h"

Creature::Creature() {
}

Creature::Creature(int PCorNPC /* = 0 */, int RaceType /* = 0 */)
{
    if (PCorNPC == PC) {
        this->atkspd = 1;
        this->RName = rinfo[RaceType].RaceName;
        this->Str = rinfo[RaceType].BaseStrength;
        this->Dex = rinfo[RaceType].BaseDextrenity;
        this->Int = rinfo[RaceType].BaseIntellegence;
        this->Endu = rinfo[RaceType].BaseEndurance;
        this->Descr = rinfo[RaceType].Description;
        this->HPMAX = rinfo[RaceType].HP_FULL;
        this->hp = this->HPMAX;
    } else {
        this->RName = rinfo[RaceType].RaceName;
        this->Str = rinfo[RaceType].BaseStrength;
        this->Dex = rinfo[RaceType].BaseDextrenity;
        this->Int = rinfo[RaceType].BaseIntellegence;
        this->Endu = rinfo[RaceType].BaseEndurance;
        this->Descr = rinfo[RaceType].Description;
        this->HPMAX = rinfo[RaceType].HP_FULL;
        this->hp = this->HPMAX;
    }
    this->IsDead = FALSE;
    this->FStyle = S_1H_SWORD;
    FTechInfo ft(FStyle);
    this->hittype = ft.GetVector();
}

void Creature::SetTohit(int Tohit) {
    this->Tohit = Tohit;
}

Creature::Creature(const Creature& orig) {
}

Creature::~Creature() {
}

void Creature::DamRecieve(int newhp) {
    this->hp = this->hp - newhp;
    if (this->hp <= 0) {
        this->IsDead = TRUE;
    }
}

int Creature::GetHp() {
    return hp;
}

int Creature::GetMeleeHitValue() {
    int damage;
    damage = this->Str;
    return damage;
}

string Creature::GetHitType(int i) {
    char ch[30];

    sprintf(ch, "%s", hittype.at(i).c_str());
    return ch;
}

void Creature::SetFightingStyle(int i) {

    this->FStyle = i;
}

double Creature::SetMonAtkSpd(int PDex) {
    double x = PDex / (this->Dex);
    return x;
}

void Creature::SetupAtkMoves() {

}